<?php include('includes/before_html.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <meta name="description" content="" />
        <meta name="keywords" content="" />
        <meta name="author" content="" />
        <title><?php echo $heading ?></title>
        <?php include('includes/head.php'); ?>
    </head>

    <body>
        <div id="wrapper">
            <?php include('includes/header.php'); ?>
            <?php include('includes/nav.php'); ?>
	    
	    
	    <!--update status-->
	    <?php
	    if (!empty($_POST['status'])) {
		$db = mysql_connect(db_server, $db_user, $db_password);
		mysql_select_db($db_dbname);
		$sql = "INSERT INTO Status (RUID,Text,TimePosted) VALUES (".$getRuid.", '".$_POST['status']."', NOW())";
		mysql_query($sql);
		mysql_close($db);
	    }
	    ?>
	    
	    
            <div id="content">
		<h3><U>Your Status</U></h3>
		<h4><i>
		<?php
		#Status Update
                $db = mysql_connect(db_server, $db_user, $db_password);
                mysql_select_db($db_dbname);
                $sql = "SELECT S.TimePosted, S.Text FROM Status S WHERE S.RUID = " . $getRuid ." ORDER BY S.id DESC";
                $result2 = mysql_query($sql);
                $count = mysql_num_rows($result2);
                if ($count == 0) {
                    echo "No Status";
                }
		else {
		    $row = mysql_fetch_array($result2);
		    echo $row['Text']." @ ". $row['TimePosted'];
		}
                mysql_close($db)
                ?>
		</i></h4>
		
		<br></br>
		<h3>Status Update</h3>
		<form action="index.php" method="post">
		    Status: <input type="text" name="status" />
		    <input type="submit" value="Post Status"/>
		</form>
		
		<br></br>
                <h3>Custom Query</h3>
                <form name="form1" method="post" action="query_results.php">
                    <table width="100%" border="0" cellpadding="3" cellspacing="1">
                        <tr>
                            <td width="100%"><textarea id="query" name="query" rows="5" cols="70"></textarea></td>
                        </tr>
                        <tr>
                            <td><input type="submit" name="Submit" value="Submit Query"></input></td>
                        </tr>
                    </table>
                </form>
            </div>
            <!-- end #content -->

            <?php include('includes/sidebar.php'); ?>
            <?php include('includes/footer.php'); ?>
        </div>
        <!-- End #wrapper -->

    </body>
</html>